<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="java.util.Set"%>
<%@ page import="java.util.List"%>
<%@ page import="tw.com.msig.b2c.car.insurance.vo.PolicyVo"%>
<%@ page import="tw.com.msig.b2c.car.insurance.vo.InsItemVo"%>
<%@ page import="tw.com.msig.b2c.car.setting.vo.CarTypeVo"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<jsp:include page="/layout/meta.jsp" />
</head>
<body>
	<div id="header">
		<jsp:include page="/layout/header.jsp" />
	</div>
	<div id="navigator">
		<jsp:include page="/layout/navigator.jsp" />
	</div>
	<div id="container" class="panel panel-default">
			<ol class="panel-heading breadcrumb">
    			<li>保單</li>
				<li>結果</li>
			</ol>
			<div class="panel-body">
				<h3>投保結果</h3>
				<form id="form" class="form-horizontal"
					action="<%=request.getContextPath()%>/application/apply.do?sActionType=step1" method="post">
					<%
						PolicyVo policyVo = (PolicyVo) request.getAttribute("policyVo");
						Set<InsItemVo> insItemVos = policyVo.getInsItemVos();
						
						String identName;
						if ("1".equals(policyVo.getIdent())) {
							identName = "自然人";
						} else {
							identName = "法人";
						}
					%>
					<fieldset disabled>
						<div class="form-group">
							<label class="col-sm-2 control-label">保單號碼</label>
							<div class="col-sm-2">
								<p class="text-primary">${policyVo.policyNo}</p>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label">保期</label>
							<div class="col-sm-2">
								<%=policyVo.getBegDate().getYear()+1900%>/<%=policyVo.getBegDate().getMonth()+1%>/<%=policyVo.getBegDate().getDate()%>
								~<%=policyVo.getEndDate().getYear()+1900%>/<%=policyVo.getEndDate().getMonth()+1%>/<%=policyVo.getEndDate().getDate()%>
							</div>	
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label">身份別</label>
							<div class="col-sm-2">
								<%=identName.toString()%>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label">身份證號</label>
							<div class="col-sm-2">
								${policyVo.idNo}
							</div>	
						</div>			
						<div class="form-group">
							<label class="col-sm-2 control-label">姓名</label>
							<div class="col-sm-2">
								${policyVo.name}
							</div>	
						</div>		
						<div class="form-group">
							<label class="col-sm-2 control-label">生日</label>
							<div class="col-sm-2">
								<%=policyVo.getBirDate().getYear()+1900%>/<%=policyVo.getBirDate().getMonth()+1%>/<%=policyVo.getBirDate().getDate()%>
							</div>	
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label">車種</label>
							<div class="col-sm-2">
									<select class="form-control">
									<%
										List<CarTypeVo> carTypeVos = (List<CarTypeVo>) request.getAttribute("carTypes");
										String selected="";
									
										for(CarTypeVo carType:carTypeVos) {
											if (carType.getCode().equals(policyVo.getCarTypeCode())) {
												selected = "selected";
											} else {
												selected = "";
											}
									%>
											<option value="<%=carType.getCode()%>" <%=selected.toString()%> > <%=carType.getName()%> </option>
									<%
										}
									%>
									</select>
							</div>	
						</div>	
						<div class="form-group">
							<label class="col-sm-2 control-label">車牌號碼</label>
							<div class="col-sm-2">
								${policyVo.licenseNo}
							</div>
						</div>	
						<div class="form-group">
							<label class="col-sm-2 control-label">險種</label>
							<div class="col-sm-2">
								<table class="table table-bordered">
									<tr>
										<td>insItemCode</td>
										<td>Description</td>
										<td>Amounts</td>
										<td>Premium</td>
									</tr>
									<%
										for(InsItemVo insItem:insItemVos) {
									%>
											<tr>
												<td>
													<%=insItem.getCode()%>
												</td>
												<td>
													<%=insItem.getDescription()%>
												</td>
												<td>
													<%=insItem.getAmounts()%>
												</td>
												<td>
													<%=insItem.getPremium()%>
												</td>
											</tr>
									<%
										}
									%>
								</table>
							</div>
						</div>
					</fieldset>
					<button id="submitBtn" class="col-sm-offset-1 btn btn-primary btn-lg">繼續新保</button>
					
				</form>
			</div>
		</div>

</body>
</html>